﻿using Estsh.Core.Controllers;
using Estsh.Core.Model.Result;
using Estsh.Core.Models;
using Estsh.Core.Wms.IServices;
using Microsoft.AspNetCore.Authorization;
using Microsoft.AspNetCore.Mvc;
using Org.BouncyCastle.Asn1.Ocsp;
using System.Collections;

namespace Estsh.Core.Web.Plugin.Wms.Areas.wms.Views.APSInterface
{
	[Route("wms/[controller]")]
	[ApiController]
	public class APSInterfaceController : WmsBaseController
	{

		private IASPInterfaceService service;

		public APSInterfaceController(IASPInterfaceService _service)
		{
			service = _service;
		}

		/// <summary>
		/// 将aps的菜单传到前台
		/// </summary>
		/// <param name="jobj"></param>
		/// <returns></returns>
		[HttpGet("GetAPSMenuList")]
		[AllowAnonymousAttribute]
		public IActionResult GetAPSMenuList(int userId, int menuId) 
		{
			WmsResponseResult result = new WmsResponseResult();
			Hashtable hashtable= new Hashtable(); 
			try
			{
				if (userId == 0 || menuId == 0 )
				{
					result.Success = false;
					result.Msg = "对象不能为空";
					return Json(result);
				}
				else
				{
					hashtable = service.GetAPSMenuInfos(userId, menuId);
					if (hashtable != null) 
					{
						result.Success = true;
						result.Data= hashtable;
						return Json(result);

					}

				}
			}
			catch (Exception ex)
			{
				result.Success = false;
				result.Msg = ex.Message;
				return Json(result);
			}
			return Json(result);
			
		}




		//public IActionResult Index()
		//{
		//	return View();
		//}


	}
}
